package com.yonyou.cyxdms.sysAuth.service.dto;

import com.yonyou.cyx.function.utils.bean.BeanMapperUtil;
import com.yonyou.cyxdms.framework.bean.dto.base.DMSBaseDTO;
import com.yonyou.cyx.framework.bean.entity.base.BasePO;
import lombok.Data;
import lombok.EqualsAndHashCode;

import java.io.Serializable;

/**
 * 菜单权限表
 *
 * @author quankk
 * @since 2019-07-05
 */
@Data
@EqualsAndHashCode(callSuper = true)
public class PermissionMenuDTO extends DMSBaseDTO implements Serializable {

    private static final long serialVersionUID = 1L;

    /**
     * 权限菜单id
     */
    private Integer permissionMenuId;

    /**
     * 权限类型(用户,角色,职位,模板角色,模板职位)
     */
    private Integer permissionType;

    /**
     * 权限类型对应的id
     */
    private Integer permissionId;

    /**
     * 菜单ID
     */
    private Long menuId;

    /**
     * 是否柔性,如果是模板角色，模板职位设置的，不可修改，此值为0
     */
    private Integer isFlexible;

    /**
     * 默认权限
     */
    private Integer isEmpowered;

    private Boolean isDeleted;

    /**
     * 将DTO 转换为PO
     * //对某个对象属性进行赋值
     * //BeanMapperUtil.populateValueByMethod(transPO,"setXxx",this.getXxx);
     *
     * @param poClass dto 需要转换的dto
     * @author quankk
     * @since 2018/7/22 0022
     */
    @Override
    public <T extends BasePO> T transDtoToPo(Class<T> poClass) {
        return super.transDtoToPo(poClass);
    }

    /**
     * 将DTO 转换为PO
     * BeanMapperUtil.populateValueByMethod(transPO,"setXxx",this.getXxx);
     *
     * @param po 需要转换的对象
     * @author quankk
     * @since 2018/7/22 0022
     */
    public <T extends BasePO> void transDtoToPo(T po) {
        BeanMapperUtil.copyProperties(this, po, "permissionMenuId");
    }

}
